package com.example.myapp.config;

import com.example.myapp.filter.MyFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {
    @Bean
    public FilterRegistrationBean myFilterRegistrationBean(){
        FilterRegistrationBean<MyFilter> filterRegistrationBean=new FilterRegistrationBean();
        filterRegistrationBean.setFilter(new MyFilter());
        //添加过滤路径
        filterRegistrationBean.addUrlPatterns("/getUser/*");
        return filterRegistrationBean;
    }
}
